'use strict';
var calculate_median = function(collection){
    let arr1=new Array();
    for(let i=0;i<collection.length;i++){
      if(collection[i]%2==0){
        arr1.push(collection[i]);
      }
    }
    let l=arr1.length;
    let result;
    if(l%2==1){
      result=arr1[(l+1)/2-1];
    }
    else{
      result=(arr1[l/2-1]+arr1[l/2])*0.5; 
    }
    return result;
};
module.exports = calculate_median;
